package com.shangxia.monomer.study.designPatterns.behavioralType.template;

import lombok.extern.slf4j.Slf4j;

/**
 * @ProjectName: monomer
 * @ClassName: TemplateDemo
 * @Time: 2021/7/25
 * @Author: zhouy
 * @Description:
 * @Experience:
 */

@Slf4j
public class TemplateDemo {
    public static void main(String[] args) {
        Template template = new MyTemplate();
        template.operate();
    }
}

abstract class Template {
    public void operate() {
        System.out.println("per...");
        myOperate();
        System.out.println("end...");
    }

    public abstract void myOperate();
}

class MyTemplate extends Template {

    @Override
    public void myOperate() {
        System.out.println("my job");
    }
}